/*
 * NodeListImpl.cpp
 *
 *  Created on: Apr 19, 2009
 *      Author: wrice
 */

#include "DOMCoreImp.h"
namespace DOMCoreImp {

Node * NodeListImp::item(unsigned long index) {
	return *getIterator( index );
}

unsigned long NodeListImp::getLength() {
	return nodeList_.size();
}

Node * NodeListImp::insert(unsigned long index, Node * newChild) {
	nodeList_.insert( getIterator( index ), newChild);
	return newChild;
}

Node * NodeListImp::remove(unsigned long index) {
	Node * victim = item( index );
	nodeList_.erase( getIterator( index ) );
	return victim;
}

NodeListImp::NodesModifierableIterator NodeListImp::getIterator(unsigned long index) {
	NodesModifierableIterator iter = nodeList_.begin();
	for(unsigned long i = 0; i < index; ++i)
		++iter;
	return iter;
}

}
